package com.tokenplus.thai.components.button

import android.content.Context
import android.util.AttributeSet
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.tokenplus.thai.base.BaseActivity
import com.tokenplus.thai.extend.getParentActivity
import com.tokenplus.thai.extend.startToCustomerServiceActivity

class CustomerServiceButton : FloatingActionButton {

    constructor(context: Context?) : this(context, null)
    constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context!!,
        attrs,
        defStyleAttr
    ) {
        //跳转客服页
        setOnClickListener {
            try {
                (getParentActivity() as BaseActivity).startToCustomerServiceActivity()
            } catch (e: Exception) {
                e.printStackTrace()
            }
        }
    }

}